#include <cv_bridge/cv_bridge.h>
#include <image_transport/image_transport.h>
#include <ros/ros.h>
#include <sensor_msgs/image_encodings.h>
#include <boost/thread/thread.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>

#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/opencv.hpp>

#include "GigECamera_Types.h"
#include "MVGigE.h"

namespace mv_driver
{
using namespace cv;
using namespace std;

class MvDriver {
public:
  MvDriver(ros::NodeHandle node, ros::NodeHandle private_nh);
  ~MvDriver();

  int init_camera();
  void capture();

private:
  boost::shared_ptr<boost::thread> poll_thread_;
  ros::NodeHandle nh_;
  ros::NodeHandle private_nh_;
  image_transport::Publisher pub;
  sensor_msgs::ImagePtr msg;
  int loop_rate_;

  HANDLE hCam;
  bool auto_exp;
  uint32_t dwWidth;
  uint32_t dwHeight;
  double sizeScale;
  int dwExp;
  MVReadBuff stReadBuff;
  uint8_t *pDataRGB;
  Mat mImageRgb;
  Mat resizeImage;
};
}
